<div id="log-container" style="height: 500px; overflow-y: scroll; background: #000; color: #aaa; padding: 10px;">
	<div></div>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../../js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script src="../../js/common.js" charset="utf-8"></script>
<script>
	layui.use(['form'], function () {
        var $ = layui.jquery,
            form = layui.form;
		
		var loginToken = getCookie('login_token');
		var appId = localStorage.getItem('appId_' + parent.layui.$("#userName").val());
        var websocket = new WebSocket('ws://'+ window.location.hostname +':'+ window.location.port +'/build/log');
        websocket.onopen = function(event) {
            websocket.send(JSON.stringify({"appId": appId, "id": parent.id, "loginToken": loginToken}));
        };
		websocket.onmessage = function(event) {
            $("#log-container div").append(event.data);
            $("#log-container").scrollTop($("#log-container div").height() - $("#log-container").height());
        };
		websocket.onclose = function(event) {
            websocket.close();
        };
		websocket.onerror = function(event){
		　　websocket.close();
		};
    });
</script>